IMPORTANT!
The PNG Utilities Plugin provides a PNGu module in REALbasic 5.5 or later, and global methods prefixed with PNGu in previous versions. Simply remove the dot from the method names below when working in REALbasic versions prior to 5.5 (must still be version 5.0 or greater however).
| PNGu.OpenAsPicture(file As FolderItem, [gamma As Single]) As Picture |
Returns a Picture containing the RGB portion of a PNG file. Alpha channels are ignored if present. Returns Nil if the file is not a valid PNG, or if an error was encountered while loading.
NOTE: Using a gamma value of -1.0 will force this function to return raw RGB colour. Omitting the gamma parameter will cause the plugin to check the file for embedded gamma first, and return raw RGB if that fails. Any positive gamma value will adjust the picture's gamma to that setting. |
| PNGu.GetPicture(data As String, [gamma As Single]) As Picture |
Returns a Picture containing the RGB portion of the PNG data contained in a string. Alpha channels are ignored if present. This function is useful to retrieve PNG images from within virtual volumes, databases, or any other custom data container. Returns Nil if the data is not a valid PNG, or if an error was encountered while creating the picture.
NOTE: Using a gamma value of -1.0 will force this function to return raw RGB colour. Omitting the gamma parameter will cause the plugin to check the data for embedded gamma first, and return raw RGB if that fails. Any positive gamma value will adjust the picture's gamma to that setting. |
PNGu.OpenAsPictureWithMask(file As FolderItem, [gamma As Single]) As Picture
|
Returns a Picture containing the RGB portion of a PNG file, and the PNG's alpha information (if present). The alpha channel is inverted and drawn into the Picture's mask property. Returns Nil if the file is not a valid PNG, or if an error was encountered while loading.
NOTE: Using a gamma value of -1.0 will force this function to return raw RGB colour. Omitting the gamma parameter will cause the plugin to check the file for embedded gamma first, and return raw RGB if that fails. Any positive gamma value will adjust the picture's gamma to that setting. |
PNGu.GetPictureWithMask(data As String, [gamma As Single]) As Picture
|
Returns a Picture containing the RGB portion of the PNG data contained in a string, and the PNG's alpha information (if present). The alpha channel is inverted and drawn into the Picture's mask property. This function is useful to retrieve PNG images from within virtual volumes, databases, or any other custom data container. Returns Nil if the data is not a valid PNG, or if an error was encountered while creating the picture.
NOTE: Using a gamma value of -1.0 will force this function to return raw RGB colour. Omitting the gamma parameter will cause the plugin to check the data for embedded gamma first, and return raw RGB if that fails. Any positive gamma value will adjust the picture's gamma to that setting. |
| PNGu.SavePicture(file As FolderItem, image As Picture, [gamma As Single]) As Boolean |
Saves a Picture as a 24bit RGB PNG, or a 32bit RGBA PNG if the picture contains a mask. Returns True if successful.
NOTE: Omitting the gamma parameter will result in the current system gamma being embedded in the file. |
| PNGu.GetData(image As Picture, [gamma As Single]) As String |
Returns a string containing raw binary PNG data for the image passed. The data will either be 24bit RGB PNG, or 32bit RGBA PNG if the picture contains a mask. Returns a nil string if an error occurs while writing the data.
NOTE: Omitting the gamma parameter will result in the current system gamma being embedded in the data. |
|